home *** CD-ROM | disk | FTP | other *** search
INI File | 2001-09-10 | 2.6 KB | 79 lines |
- [Name]
- RollAround - From Matthew's Motion Suite.
- By Matthew Peterson, matthew@pinoko.berkeley.edu
-
- [Description]
- 2-19-2000
- Drop this on a sprite, and it will roll around the edge of the sprite track.
-
- [Parameters]
-
- Roll Direction ±1, MP_InitialRollDirection,1,-1,1
- Roll Speed 1-20, MP_RollAngleStep,5,1,20
-
- [Frame loaded]
- Spritevars MP_whichcorner MP_currentcornerx MP_currentcornery MP_rolldirection
- //Initialize variables.
- MP_whichcorner = 4
- MP_rolldirection = $MP_InitialRollDirection
- //Move the sprite to the bottom of the track
- spriteofid($ThisSpriteID).moveby(trackwidth/2 - spriteofid($ThisSpriteID).boundsright,trackheight - spriteofid($ThisSpriteID).boundsbottom)
-
- [Idle]
- Spritevars MP_whichcorner MP_currentcornerx MP_currentcornery MP_rolldirection
- localvars MP_tempcornerx MP_tempcornery
- //RollAround by Matthew Peterson
- //This is a very simple motion. A sprites rolls around the edge
- //of the movie pivoting around the corner of the sprite currently
- //touching the movie's border.
-
- //First remember the location of the current pivoting corner
- executeevent(200081)
- //Place in temporary variable.
- MP_tempcornerx = MP_currentcornerx
- MP_tempcornery = MP_currentcornery
-
- rotate($MP_RollAngleStep * MP_rolldirection)//rotate in the current direction
- executeevent(200081)//Get the new corner position so we know how much
- //to move the sprite by to get it in the correct position.
- moveby(MP_tempcornerx-MP_currentcornerx,MP_tempcornery-MP_currentcornery)
- //Check to see if we have rotated out of bounds. If so, then change
- //the pivot corner.
- if(boundsbottom > trackheight)
- moveby(0,trackheight- boundsbottom)
- MP_whichcorner = MP_whichcorner - MP_rolldirection
- elseif(boundsleft < 0)
- moveby(- boundsleft,0)
- MP_whichcorner = MP_whichcorner - MP_rolldirection
- elseif(boundstop < 0)
- moveby(0,- boundstop)
- MP_whichcorner = MP_whichcorner - MP_rolldirection
- elseif(boundsright > trackwidth)
- moveby(trackwidth- boundsright,0)
- MP_whichcorner = MP_whichcorner - MP_rolldirection
- endif
- //wrap around the four corners.
- if(MP_whichcorner = 0)
- MP_whichcorner = 4
- elseif(MP_whichcorner = 5)
- MP_whichcorner = 1
- endif
-
-
- [200081 MP_RollGetCorners]
- Spritevars MP_whichcorner MP_currentcornerx MP_currentcornery
- //Remember the location of the current
- //pivot corner.
- if(MP_whichcorner = 1)
- MP_currentcornerx = firstcornerx
- MP_currentcornery = firstcornery
- elseif(MP_whichcorner = 2)
- MP_currentcornerx = secondcornerx
- MP_currentcornery = secondcornery
- elseif(MP_whichcorner = 3)
- MP_currentcornerx = thirdcornerx
- MP_currentcornery = thirdcornery
- elseif(MP_whichcorner = 4)
- MP_currentcornerx = fourthcornerx
- MP_currentcornery = fourthcornery
- endif